package creational.factorymethod;

/**
 * @author mingmeng
 * @desciption 工厂模式，假设场景：可口可乐工厂
 */
public class CocaColaFactory {
    private String name;
    private String price;

    private CocaColaFactory(String name, String price) {
        this.name = name;
        this.price = price;
    }

    public static CocaColaFactory getCola() {
        return new CocaColaFactory("Cola", "3");
    }

    public static CocaColaFactory getSprite() {
        return new CocaColaFactory("Sprite", "4");
    }

    @Override
    public String toString() {
        return "this is " + name + " its price is " + price;
    }

    public static void main(String[] args) {
        System.out.println(getCola());
        System.out.println(getSprite());
    }
}
